package core;

public class Function {
	private int tempoMax;
	private double maxConnection;
	private double valAFunction;

	public Function(int tMax, double maxCon) {
		tempoMax = tMax;
		maxConnection = maxCon;
		
		valAFunction = (3 * maxConnection * Math.sqrt(3)) / ((tempoMax*tempoMax*tempoMax) * 2);
		
		System.out.println("Il valore del parametro 'A' della funzione e': " + valAFunction);
		System.out.println("Il valore del numeratore del funzione relativa al parametro 'A' e': " + (3 * maxConnection * Math.sqrt(3)));
	}
	
	public int getFunction(double tempo){
		double numConnection = (-valAFunction)*( ((tempoMax*tempoMax)*(tempo-tempoMax)) - ((tempo-tempoMax)*(tempo-tempoMax)*(tempo-tempoMax)) );
	    int numConnectionArrivate = (int) Math.round(numConnection);
		return numConnectionArrivate;
	}
}
